# coding=utf8
# 全世界最帅的帅哥
from comment.utils.serializers import BaseListSerializer, BaseSerializer


class InvitedListSerializer(BaseListSerializer):
    # 邀请名单列表的序列化
    def to_dict(self):
        invite_friend_list = []
        for friend in self.data_list:
            invite_friend_list.append(
                {
                    "name": friend.username,
                    "id": friend.id,
                    "registerTime": friend.registerTime.strftime("%Y-%m-%d %h:%M:%S"),
                    "award": "代金券50"
                }
            )
        return invite_friend_list


class UserInfoSerializer(BaseSerializer):
    def to_dict(self):
        user_info = self.data
        return {
            "userName": user_info.username,
            "nickName": user_info.nick_name,
            "realNameAuth": user_info.realNameStatus,
            "phone": user_info.phone,
            "loginPwdStatus": 1,
            "payPwdStatus": user_info.payPwdStatus,
            "avatar": user_info.avatar,
            "invite_code": user_info.inviteId
        }
